﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using FrienDev.BusinessRules;

namespace UnitTest
{
    /// <summary>
    /// Summary description for FriendTest
    /// </summary>
    [TestClass]
    public class FriendTest
    {
        public FriendTest()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        [TestMethod]
        public void TestAddFriend()
        {
            FriendRules.Instance.AddFriend("c180360bef7a4ffe5b514285aba649e3", "8c5e14d9c787e9a1756462b4125fbff3",
                "可以和你交个朋友么？");
            FriendRules.Instance.AcceptFriend("c180360bef7a4ffe5b514285aba649e3", "8c5e14d9c787e9a1756462b4125fbff3");
        }

        [TestMethod]
        public void TestSendSystemMessage()
        {
            /* *参数列表
           第一个是应用程序英文名，第二个是消息类别名称；
         * 第三个是发送时间，第四个是发送者ID，第五个是发送者姓名，
         * 第六个是附加消息，第七个，也就是最后一个，是MessageId
         */
            ApiHelper.Instance.SendSystemMessage("Friend"
                , "Request"
                , "376b26ac1c1bed4211fcc236e58df1e9"
                , new string[] { "8c5e14d9c787e9a1756462b4125fbff3", "郑浩宇", "你好，我是郑浩宇" });
            ApiHelper.Instance.SendSystemMessage("Friend"
                , "Request"
                , "8c5e14d9c787e9a1756462b4125fbff3"
                , new string[] { "376b26ac1c1bed4211fcc236e58df1e9","刘磊", "你好，我是刘磊" });
           
        }

        [TestMethod]
        public void TestChangeSystemMessageRequestType()
        {
            ApiHelper.Instance.ChangeSystemMessageRequestType(132, "Accept");
        }
    }
}
